package com.ihr360.cnb.module.oneclick.service;

import cn.irenshi.entity.account.WebUserSimpleEntity;
import com.ihr360.cnb.module.oneclick.service.fallback.IrenshiDubboProviderServiceFallback;
import com.ihr360.commons.entity.AuthUserInfo;
import com.ihr360.entity.ApplicationApprovalEntity;
import com.ihr360.entity.BasicStaffCurrentSalaryInfo;
import com.ihr360.entity.IrsStaffSalaryProfile;
import com.ihr360.entity.StaffBankSalaryEntity;
import com.ihr360.feign.configuration.FeignConfiguration;
import com.ihr360.insurance.entity.vo.IrenshiBenefitSimpleVo;
import com.ihr360.insurance.entity.vo.StaffBenefitEntity;
import com.ihr360.oneclick.modal.OneClickStaff;
import com.ihr360.oneclick.vo.StaffMonthMessageVo;
import com.ihr360.oneclick.vo.WechatStaffInfoVo;
import com.ihr360.payroll.entity.staff.StaffSalaryEntity;
import com.ihr360.payroll.request.ApplicationApprovalRequest;
import com.ihr360.payroll.request.attendance.AttendanceTakeNumberRequest;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * irenshi dubbo provider
 *
 * @author tom
 * @date 17-6-21
 */

@FeignClient(name = "irenshi-dubbo-provider", fallback = IrenshiDubboProviderServiceFallback.class,
        configuration = {FeignConfiguration.class})
public interface IrenshiDubboProviderService {

    /**
     * 批量注册 app user
     *
     * @param oneClickStaffList
     * @return
     */
    @RequestMapping(value = "/appUser/register/batch", method = RequestMethod.POST)
    Map<String, String> registerStaffRecordAppUser(@RequestBody List<OneClickStaff> oneClickStaffList);

    /**
     * 获取薪资月份
     *
     * @param authUserInfo
     * @return
     */
    @RequestMapping(value = "/salary/month/list", method = RequestMethod.POST)
    List<String> getSalaryMonthList(@RequestBody AuthUserInfo authUserInfo);

    /**
     * 获取所属月的薪资详情
     *
     * @param authUserInfo
     * @param monthly
     * @return
     */
    @RequestMapping(value = "/salary/monthly/detail", method = RequestMethod.POST)
    StaffMonthMessageVo getSalaryDetail(@RequestBody AuthUserInfo authUserInfo, @RequestParam(value = "monthly") String monthly);

    /**
     * 获取员工信息
     *
     * @return
     */
    @RequestMapping(value = "/appUser/staff/info", method = RequestMethod.POST)
    WechatStaffInfoVo getStaffInfo(@RequestBody AuthUserInfo authUserInfo);

    /**
     * 获取获取irs试用期数据需要迁移的公司
     *
     * @return
     */
    @RequestMapping(value = "/staffPayrollProfile/datafix/probation/companyIds", method = RequestMethod.GET)
    List<String> getIrsSalaryProbationCompanyIds();

    /**
     * 得到某公司员工试用期数据，用于员工薪资数据迁移
     *
     * @param companyId
     * @return
     */
    @RequestMapping(value = "/staffPayrollProfile/datafix/probation/salaryprofile", method = RequestMethod.GET)
    List<IrsStaffSalaryProfile> getIrsSalaryProfile(@RequestParam(value = "companyId") String companyId);

    @RequestMapping(value = "/staffPayrollProfile/datafix/salaryInfo/excepIds", method = RequestMethod.GET)
    List<BasicStaffCurrentSalaryInfo> findStaffSalaryInfoExceptStaffids(@RequestParam(value = "companyId") String companyId, @RequestParam(value = "exitStaffIds") List<String> exitStaffIds);

    @RequestMapping(value = "/attendanceApplication/unapproved/application", method = RequestMethod.POST)
    Map<String, Integer> getUnapprovedCount(@RequestParam(value = "companyId") String companyId, @RequestBody AttendanceTakeNumberRequest request);

    @RequestMapping(value = "/staffSalary/bankInfo/save", method = RequestMethod.POST)
    void saveStaffSalaryInfo(@RequestBody StaffSalaryEntity staffSalaryEntity);

    @RequestMapping(value = "/staffSalary/benefit/list", method = RequestMethod.GET)
    List<IrenshiBenefitSimpleVo> queryBenefitList(@RequestParam(value = "companyId") String companyId);

    @RequestMapping(value = "/staffSalary/insurance/save", method = RequestMethod.POST)
    void saveStaffInsuranceInfo(@RequestParam(value = "companyId") String companyId, @RequestBody StaffBenefitEntity staffBenefitEntity);

    @GetMapping(value = "/staffInfo/staffName/{staffId}")
    public String getStaffName(@RequestParam(value = "staffId") String staffId);

    @RequestMapping(value = "/cnb/application/submit/approval", method = RequestMethod.POST)
    ApplicationApprovalEntity submitApproval(@RequestBody ApplicationApprovalRequest applicationApprovalRequest);

    /**
     * 获取公司的全部用户
     *
     * @param companyId
     * @return
     */
    @RequestMapping(value = "/web/user/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    List<WebUserSimpleEntity> getWebUsers(@RequestParam(value = "companyId") String companyId);

    /**
     * 查询所有公司id
     */
    @RequestMapping(value = "/staffBankBenefit/datafix/all/companyIds", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    List<String> getAllCompanyIds(@RequestParam(value = "lastId") String lastId, @RequestParam(value = "limit") Integer limit);

    /**
     * 查询公司员工银行卡福利信息
     */
    @RequestMapping(value = "/staffBankBenefit/datafix/company/staff", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    List<StaffBankSalaryEntity> getCompanyStaffInfo(@RequestParam(value = "companyId") String companyId);
}




